'use strict';
var Sequelize = require ('sequelize');
var config = require ('../config');

//判断是开发环境还是正式环境
var DB = config.getDB ();

//模型层统一的数据库连接
var db = new Sequelize (
  DB.dbname,
  DB.user,
  DB.password,
  {
    host: DB.host,
    dialect: DB.type,
    pool: {
      max: 5,
      min: 0,
      idle: 10000
    }
  });

module.exports = db;